home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / bp70lib.zip / WINLIB.DOC < prev    next >
Text File  |  1993-04-15  |  6KB  |  130 lines

  1. unit winlib;
  2.  
  3. interface
  4.  
  5. type winptr=^winrec;
  6.      winrec=record
  7.             x1,y1,x2,y2, { ul & lr corners }
  8.  
  9.             wintype,     { developer defined - # indicates what kind of
  10.                            win for drawing, running, opening, closing,
  11.                            etc. }
  12.  
  13.             zoom,        { 0=normal, 1=iconified, 2=full screen }
  14.  
  15.             wincol,scrollcol,btncol,btntxt,titletxt,titlebak, { colors }
  16.  
  17.             scrollrate,       { scroll rate for scroll bars }
  18.  
  19.             ox1,oy1,ox2,oy2,  { saves corners @ zoom=0 for return to zoom=0
  20.                                 from zoom=1 or zoom=2 }
  21.  
  22.             ix,iy:integer;    { UL corner for zoom=1 }
  23.  
  24.             width,height,     { width & height of contents (for scaling
  25.                                 scrollbars) }
  26.  
  27.             xoff,yoff:longint; { offsets of contents }
  28.  
  29.             title:string;
  30.             next:winptr;     { points to next win in linked list of wins }
  31.             data:pointer;    { developer defined. use typecasting to treat
  32.                                this as a pointer to a dynamically
  33.                                allocated data structure which is specific
  34.                                to the wintype. In this manner you may tack
  35.                                wintype specific data onto a generic window
  36.                                record. Allocating, deallocating, loading,
  37.                                saving, and initializing wintype specific
  38.                                data is not handled by winlib. }
  39.             redraw:boolean;  { used when redrawing windows }
  40.             end;
  41.      winproc=procedure(var p:winptr); { developer defined procedure for running
  42.                                     or drawing windows }
  43.      winfile=file of winrec;
  44.  
  45.  
  46.  
  47.  
  48. {############################# generial routines ###########################}
  49.  
  50. procedure raisewin(var p,wins:winptr);
  51.                           { raises window p to top of window list wins }
  52. function runwin(var p,wins:winptr; bakcolor,style:integer;
  53.                 drawcon,runcon:winproc; dosound:boolean):boolean;
  54.        { p is win to run, wins is winlist. returns true if selected close }
  55. procedure openwin(var p:winptr; r:winrec);
  56.                                 { p is winlist, inserts at front }
  57. procedure closewin(var p:winptr; p2:winptr);
  58.                             { p is winlist, p2 is window to close}
  59. procedure savewins(var wins:winptr; s:string);
  60.                                     { saves windows in list wins to file s }
  61. procedure loadwins(var wins:winptr; s:string);
  62.                                  { loads windows from file s into list wins }
  63.  
  64. function numwins(wins:winptr):integer;
  65.                                       { returns # of windows in list wins }
  66. function is_covered(i,wins:winptr):boolean;
  67.    { true if win i is covered in whole or part by any window in winlist wins }
  68.  
  69.  
  70.  
  71.  
  72.  
  73. {############################# mouse routines #############################}
  74.  
  75. function inwin(p:winptr):boolean;
  76.             { returns TRUE if mouse is currently located within window p }
  77. function wmx(p:winptr):integer;     { returns mousex in win p virt coords }
  78. function wmy(p:winptr):integer;     { returns mousey in win p virt coords }
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85. {############################## drawing routines ##########################}
  86.  
  87. procedure drawwin(p:winptr);                 { p is win to draw }
  88. procedure winport(p:winptr);          { sets viewport to window p.  }
  89. procedure drawwins(wins:winptr; bak,fill:integer; drawcon:winproc);
  90.       { redraws entire screen including all windows and their contents. bak
  91.         is background color. fill is background fillstyle. drawcon is a
  92.         developer defined procedure that draws the contents of a window based
  93.         on its window type. }
  94. procedure saywin(x,y,color,font,size,orientation,hjustify,vjustify,multx,
  95.                   divx,multy,divy:integer; s:string; p:winptr);
  96.           { saygraf3d in win p, handles scroll offsets, x & y in win coords,
  97.             assumes winport(p) is on already }
  98. procedure winpanel(x1,y1,x2,y2,width,color:integer; pressed:boolean;
  99.                    p:winptr);
  100.           { panel in win p, handles scroll offsets, x1,y1,x2,y2 in win
  101.             coords, assumes winport(p) is on already }
  102. procedure winfill(x1,y1,x2,y2,color,fillstyle:integer; p:winptr);
  103.           { does fill in window p. assumes winport(p) is on already }
  104. procedure winline(x1,y1,x2,y2,color,style,thickness:integer; p:winptr);
  105.           { does line in window p. assumes winport(p) is on already }
  106. procedure winpie(x,y,sa,ea,r,fore,bak,style:integer; p:winptr);
  107.            { does grafpie in win p. assumes winport on }
  108. procedure zoomwin(var p,wins:winptr; drawcon:winproc; bakcolor,style:integer);
  109.            { zooms window p in list wins full size. drawcon is developer
  110.            defined draw win contents procedure. bakcolor and style are for
  111.            the background }
  112. procedure doiconify(p:winptr; var wins:winptr; bakcolor,style:integer; drawcon:winproc);
  113.            { iconifies window p. all parameters are as in zoomwin. }
  114. procedure winbtn(x,y,fore,bak:integer; s:string; pressed:boolean; p:winptr);
  115.           { does a btn in window p. assumes winport on. }
  116. procedure winbtn2(x,y,fore,bak:integer; s:string; pressed:boolean; p:winptr);
  117.           { does a btn2 in window p. assumes winport on. }
  118. procedure presswinbtn(x,y,fore,bak:integer; s:string; doclick:boolean; p:winptr);
  119.      { turns on winport, does a pressbtn in window p. turns off winport. }
  120. procedure presswinbtn2(x,y,fore,bak:integer; s:string; doclick:boolean; p:winptr);
  121.     { as presswinbtn but for btn2's  }
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128. implementation
  129.  
  130.